﻿using System;
using System.IO;
using UnityEngine;

namespace XUtliPoolLib
{
	// Token: 0x02000052 RID: 82
	public sealed class ShaderManager : XSingleton<ShaderManager>
	{
		// Token: 0x1700006E RID: 110
		// (get) Token: 0x060002A4 RID: 676 RVA: 0x00014BBC File Offset: 0x00012DBC
		public static Shader _skin_effect
		{
			get
			{
				if (ShaderManager.m_skin_effect == null)
				{
					ShaderManager.m_skin_effect = XSingleton<ShaderManager>.singleton.FindShader("Skin-Effect", "Custom/Skin/Effect");
				}
				return ShaderManager.m_skin_effect;
			}
		}

		// Token: 0x1700006F RID: 111
		// (get) Token: 0x060002A5 RID: 677 RVA: 0x00014BFC File Offset: 0x00012DFC
		public static Shader _skin8
		{
			get
			{
				if (ShaderManager.m_skin8 == null)
				{
					ShaderManager.m_skin8 = XSingleton<ShaderManager>.singleton.FindShader("Skin-RimLightBlend8", "Custom/Skin/RimlightBlend8");
				}
				return ShaderManager.m_skin8;
			}
		}

		// Token: 0x17000070 RID: 112
		// (get) Token: 0x060002A6 RID: 678 RVA: 0x00014C3C File Offset: 0x00012E3C
		public static Shader _skin_blend
		{
			get
			{
				if (ShaderManager.m_skin_blend == null)
				{
					ShaderManager.m_skin_blend = XSingleton<ShaderManager>.singleton.FindShader("Skin-RimLightBlend", "Custom/Skin/RimlightBlend");
				}
				return ShaderManager.m_skin_blend;
			}
		}

		// Token: 0x17000071 RID: 113
		// (get) Token: 0x060002A7 RID: 679 RVA: 0x00014C7C File Offset: 0x00012E7C
		public static Shader _skin_cutout
		{
			get
			{
				if (ShaderManager.m_skin_cutout == null)
				{
					ShaderManager.m_skin_cutout = XSingleton<ShaderManager>.singleton.FindShader("Skin-RimLightBlendCutout", "Custom/Skin/RimlightBlendCutout");
				}
				return ShaderManager.m_skin_cutout;
			}
		}

		// Token: 0x17000072 RID: 114
		// (get) Token: 0x060002A8 RID: 680 RVA: 0x00014CBC File Offset: 0x00012EBC
		public static Shader _skin_cutout4
		{
			get
			{
				if (ShaderManager.m_skin_cutout4 == null)
				{
					ShaderManager.m_skin_cutout4 = XSingleton<ShaderManager>.singleton.FindShader("Skin-RimLightBlendCutout4", "Custom/Skin/RimlightBlendCutout4");
				}
				return ShaderManager.m_skin_cutout4;
			}
		}

		// Token: 0x17000073 RID: 115
		// (get) Token: 0x060002A9 RID: 681 RVA: 0x00014CFC File Offset: 0x00012EFC
		public static Shader _fade_maskR_noLight
		{
			get
			{
				if (ShaderManager.m_fade_maskR_noLight == null)
				{
					ShaderManager.m_fade_maskR_noLight = XSingleton<ShaderManager>.singleton.FindShader("FadeMaskRNoLight", "Custom/Common/FadeMaskRNoLight");
				}
				return ShaderManager.m_fade_maskR_noLight;
			}
		}

		// Token: 0x17000074 RID: 116
		// (get) Token: 0x060002AA RID: 682 RVA: 0x00014D3C File Offset: 0x00012F3C
		public static Shader _transparentGrayMaskRNoLight
		{
			get
			{
				if (ShaderManager.m_transparentGrayMaskRNoLight == null)
				{
					ShaderManager.m_transparentGrayMaskRNoLight = XSingleton<ShaderManager>.singleton.FindShader("TransparentGrayMaskRNoLight", "Custom/Common/TransparentGrayMaskRNoLight");
				}
				return ShaderManager.m_transparentGrayMaskRNoLight;
			}
		}

		// Token: 0x17000075 RID: 117
		// (get) Token: 0x060002AB RID: 683 RVA: 0x00014D7C File Offset: 0x00012F7C
		public static Shader _color
		{
			get
			{
				if (ShaderManager.m_color == null)
				{
					ShaderManager.m_color = Shader.Find("Custom/Effect/Color");
				}
				return ShaderManager.m_color;
			}
		}

		// Token: 0x17000076 RID: 118
		// (get) Token: 0x060002AC RID: 684 RVA: 0x00014DB4 File Offset: 0x00012FB4
		public static Shader _maskR
		{
			get
			{
				if (ShaderManager.m_maskR == null)
				{
					ShaderManager.m_maskR = XSingleton<ShaderManager>.singleton.FindShader("CustomShadowR", "Custom/Scene/CustomShadowR");
				}
				return ShaderManager.m_maskR;
			}
		}

		// Token: 0x17000077 RID: 119
		// (get) Token: 0x060002AD RID: 685 RVA: 0x00014DF4 File Offset: 0x00012FF4
		public static Shader _radialBlur
		{
			get
			{
				if (ShaderManager.m_radialBlur == null)
				{
					ShaderManager.m_radialBlur = XSingleton<ShaderManager>.singleton.FindShader("RadialBlur", "Hidden/radialBlur");
				}
				return ShaderManager.m_radialBlur;
			}
		}

		// Token: 0x17000078 RID: 120
		// (get) Token: 0x060002AE RID: 686 RVA: 0x00014E34 File Offset: 0x00013034
		public static Shader _blackWhite
		{
			get
			{
				if (ShaderManager.m_blackWhite == null)
				{
					ShaderManager.m_blackWhite = XSingleton<ShaderManager>.singleton.FindShader("BlackWhite", "Hidden/blackWhite");
				}
				return ShaderManager.m_blackWhite;
			}
		}

		// Token: 0x17000079 RID: 121
		// (get) Token: 0x060002AF RID: 687 RVA: 0x00014E74 File Offset: 0x00013074
		public static Shader _gausBlur
		{
			get
			{
				if (ShaderManager.m_gausBlur == null)
				{
					ShaderManager.m_gausBlur = XSingleton<ShaderManager>.singleton.FindShader("BlurEffectConeTaps", "Hidden/BlurEffectConeTap");
				}
				return ShaderManager.m_gausBlur;
			}
		}

		// Token: 0x060002B0 RID: 688 RVA: 0x00014EB4 File Offset: 0x000130B4
		public bool Awake(RuntimePlatform editorPlatform)
		{
			ShaderManager._ShaderKeyMainTex = Shader.PropertyToID("_MainTex");
			ShaderManager._ShaderKeyMaskTex = Shader.PropertyToID("_Mask");
			ShaderManager._ShaderKeyIDColor0 = Shader.PropertyToID("_Color");
			ShaderManager._ShaderKeyIDHairColor = Shader.PropertyToID("_HairColor");
			ShaderManager._ShaderKeyIDFace = Shader.PropertyToID("_Face");
			ShaderManager._ShaderKeyIDHair = Shader.PropertyToID("_Hair");
			ShaderManager._ShaderKeyIDBody = Shader.PropertyToID("_Body");
			ShaderManager._ShaderKeyIDAlpha = Shader.PropertyToID("_Alpha");
			for (int i = 0; i < ShaderManager._ShaderKeyIDSkin.Length; i++)
			{
				ShaderManager._ShaderKeyIDSkin[i] = Shader.PropertyToID("_Tex" + i.ToString());
			}
			string text = null;
			RuntimePlatform platform = Application.platform;
			if (platform != RuntimePlatform.IPhonePlayer)
			{
				if (platform != RuntimePlatform.Android)
				{
					if (editorPlatform != RuntimePlatform.WindowsPlayer)
					{
						if (editorPlatform != RuntimePlatform.IPhonePlayer)
						{
							if (editorPlatform == RuntimePlatform.Android)
							{
								text = string.Format("{0}/update/Android/AssetBundles/shaders.ab", Application.streamingAssetsPath);
							}
						}
						else
						{
							text = string.Format("{0}/update/iOS/AssetBundles/shaders.ab", Application.streamingAssetsPath);
						}
					}
					else
					{
						text = string.Format("{0}/update/AssetBundles/shaders.ab", Application.streamingAssetsPath);
					}
					if (!File.Exists(text))
					{
						text = null;
					}
				}
				else
				{
					text = string.Format("{0}!assets/update/Android/AssetBundles/shaders.ab", Application.dataPath);
				}
			}
			else
			{
				text = string.Format("{0}/Raw/update/iOS/AssetBundles/shaders.ab", Application.dataPath);
			}
			if (!string.IsNullOrEmpty(text))
			{
				this.m_ShaderAB = AssetBundle.LoadFromFile(text);
			}
			return true;
		}

		// Token: 0x060002B1 RID: 689 RVA: 0x00015034 File Offset: 0x00013234
		public Shader FindShader(string name0, string name1)
		{
			Shader shader = null;
			if (this.m_ShaderAB != null)
			{
				shader = this.m_ShaderAB.LoadAsset<Shader>(name0);
			}
			if (shader == null)
			{
				shader = Shader.Find(name1);
			}
			return shader;
		}

		// Token: 0x060002B2 RID: 690 RVA: 0x0001507C File Offset: 0x0001327C
		public static void SetColor32(MaterialPropertyBlock mpb, Color32 color, int keyID)
		{
			mpb.SetColor(keyID, color);
		}

		// Token: 0x060002B3 RID: 691 RVA: 0x0001508D File Offset: 0x0001328D
		public static void SetColor(MaterialPropertyBlock mpb, Color color, int keyID)
		{
			mpb.SetColor(keyID, color);
		}

		// Token: 0x060002B4 RID: 692 RVA: 0x0001509C File Offset: 0x0001329C
		public static void SetTexture(MaterialPropertyBlock mpb, Texture tex, int keyID)
		{
			if (tex != null)
			{
				mpb.SetTexture(keyID, tex);
			}
		}

		// Token: 0x060002B5 RID: 693 RVA: 0x000150C0 File Offset: 0x000132C0
		public static void SetFloat(MaterialPropertyBlock mpb, float value, int keyID)
		{
			mpb.SetFloat(keyID, value);
		}

		// Token: 0x04000256 RID: 598
		private static Shader m_skin_effect = null;

		// Token: 0x04000257 RID: 599
		private static Shader m_skin8 = null;

		// Token: 0x04000258 RID: 600
		private static Shader m_skin_blend = null;

		// Token: 0x04000259 RID: 601
		private static Shader m_skin_cutout = null;

		// Token: 0x0400025A RID: 602
		private static Shader m_skin_cutout4 = null;

		// Token: 0x0400025B RID: 603
		private static Shader m_fade_maskR_noLight = null;

		// Token: 0x0400025C RID: 604
		private static Shader m_transparentGrayMaskRNoLight = null;

		// Token: 0x0400025D RID: 605
		private static Shader m_color = null;

		// Token: 0x0400025E RID: 606
		private static Shader m_maskR = null;

		// Token: 0x0400025F RID: 607
		public static Shader _maskG;

		// Token: 0x04000260 RID: 608
		public static Shader _maskB;

		// Token: 0x04000261 RID: 609
		public static Shader _maskA;

		// Token: 0x04000262 RID: 610
		private static Shader m_radialBlur = null;

		// Token: 0x04000263 RID: 611
		private static Shader m_blackWhite = null;

		// Token: 0x04000264 RID: 612
		private static Shader m_gausBlur = null;

		// Token: 0x04000265 RID: 613
		private AssetBundle m_ShaderAB = null;

		// Token: 0x04000266 RID: 614
		public static int _ShaderKeyMainTex;

		// Token: 0x04000267 RID: 615
		public static int _ShaderKeyMaskTex;

		// Token: 0x04000268 RID: 616
		public static int _ShaderKeyIDColor0;

		// Token: 0x04000269 RID: 617
		public static int _ShaderKeyIDHairColor;

		// Token: 0x0400026A RID: 618
		public static int _ShaderKeyIDFace;

		// Token: 0x0400026B RID: 619
		public static int _ShaderKeyIDHair;

		// Token: 0x0400026C RID: 620
		public static int _ShaderKeyIDBody;

		// Token: 0x0400026D RID: 621
		public static int _ShaderKeyIDAlpha;

		// Token: 0x0400026E RID: 622
		public static int[] _ShaderKeyIDSkin = new int[8];
	}
}
